<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>扩展运算-合并数组或对象</h1>
    <script>
        var arr = [1, 2, 3]
        var arr2 = [4, 5, 6]
        // 合并数组元素
        var arr3 = [...arr, ...arr2]
        console.log(arr3);

        var obj={name:"jack"}
        var obj2={age:20,city:'北京'}
         // 合并对象
        var obj3={...obj,...obj2}
        console.log(obj3);
        
    </script>
</body>

</html>